package org.linlinjava.litemall.core.util;

import com.google.common.collect.Lists;
import org.linlinjava.litemall.db.domain.LitemallGoods;
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
import org.linlinjava.litemall.db.domain.LitemallGoodsSpecification;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author Administrator
 * @since 2020/2/5 23:33
 */
public class LitemallGoodsUtil {

    public static LitemallGoodsSpecification[] initSpecification(LitemallGoods goods) {
        LitemallGoodsSpecification goodsSpecification = new LitemallGoodsSpecification();
        goodsSpecification.setSpecification("规格");
        goodsSpecification.setValue(goods.getName());
        goodsSpecification.setAddTime(LocalDateTime.now());
        goodsSpecification.setUpdateTime(LocalDateTime.now());
        goodsSpecification.setDeleted(false);

        return new LitemallGoodsSpecification[]{goodsSpecification};
    }

    public static LitemallGoodsProduct[] initGoodsProduct(LitemallGoods goods) {
        LitemallGoodsProduct goodsProduct = new LitemallGoodsProduct();
        goodsProduct.setSpecifications(new String[]{goods.getName()});
        goodsProduct.setPrice(goods.getRetailPrice());
        goodsProduct.setNumber(goods.getNumber());
        goodsProduct.setAddTime(LocalDateTime.now());
        goodsProduct.setUpdateTime(LocalDateTime.now());
        goodsProduct.setDeleted(false);

        return new LitemallGoodsProduct[]{goodsProduct};
    }
}
